from django.urls import re_path, path
from . import views
from django.urls import converters, register_converter


class Define(object):
    regex = '[0-9]+'

    def to_python(self, value):
        print('转换之前' + value)
        return value

    def to_url(self, value):
        print('反转之后' + value)
        return 3

register_converter(Define, 'mingda')

urlpatterns = [
    path('', views.index),
    path('list/<mingda:list_id>', views.article_list, name='list'),
    path('cate/<cate_id>', views.article_cate, name='cate'),
]
